//
//  DYCleanUpToolBar.m
//  PrivatePhoto
//
//  Created by PrivatePhoto Team on 2021.
//  Copyright © 2021年 PrivatePhoto Team. All rights reserved.
//

#import "DYCleanUpToolBar.h"

@implementation DYCleanUpToolBar

+ (id)instanceView {
    NSArray* nibView =  [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil];
    return [nibView objectAtIndex:0];
}

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
    //去掉点击效果
    _deleteButton.adjustsImageWhenHighlighted = NO;
}
    
- (void)setData:(id)data delegate:(id)delegate {

    _delegate = delegate;
    
    if ([data isKindOfClass:[CACleanUpToolBarModel class]]) {
        CACleanUpToolBarModel *model = data;
        _model = model;
    }

}

- (IBAction)buttonAction:(UIButton *)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(cleanUpToolBar:buttonAction:)]) {
        [_delegate cleanUpToolBar:self buttonAction:sender];
    }
}

@end


#pragma mark - Model

@implementation CACleanUpToolBarModel

+ (CACleanUpToolBarModel *)ittemModelWithTitle:(NSString *)title isAllow:(BOOL)isAllow {
    CACleanUpToolBarModel *model = [CACleanUpToolBarModel new];
    model.title = kSafeString(title);
    model.isAllow = isAllow;
    return model;
}

@end
